<template>
  <div>
    <el-form label-width="80px" label-position="left" :model="searchForm">
      <el-row>
        <el-col :span="8">
          <el-form-item label="用户昵称">
            <el-input v-model="searchForm.userName"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="角色名称">
            <el-input v-model="searchForm.roleName"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-button @click="onSearch" type="primary">查 询</el-button>
          <el-button @click="reset()">重 置</el-button>
        </el-col>
      </el-row>
    </el-form>
    <page-table
      :data="tableData"
      :total="count"
      :page="pageIndex"
      :pageSize="pageSize"
      ref="pageTable"
      showIndex
      @currentChange="currentChange"
      @sizeChange="sizeChange"
      :loading="loading"
    >
      <el-table-column
        prop="userNickName"
        label="用户名"
        show-overflow-tooltip
      ></el-table-column>
      <el-table-column
        prop="roleName"
        label="角色"
        show-overflow-tooltip
      ></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="{ row }">
          <el-button type="text" @click="toEdit(row.id)">修改</el-button>
          <el-button type="text" @click="toDetail(row.id)">详情</el-button>
        </template>
      </el-table-column>
    </page-table>
    <post-dialog @cancel="cancel" :dialogVisible="dialogVisible" :opId="opId" />
    <detail-dialog
      @cancel="cancel1"
      :dialogVisible="dialogVisible1"
      :opId="opId"
    />
  </div>
</template>

<script>
import DetailDialog from "../components/detailDialog";
import PostDialog from "../components/postDialog";
import initData from "../../../mixins/initData";

export default {
  components: { DetailDialog, PostDialog },
  name: "authManage",
  mixins: [initData],
  data() {
    return {
      getUrl: "/api/userAndRole/userAndRole",
      searchForm: {
        userName: "",
        roleName: ""
      }
    };
  }
};
</script>

<style scoped></style>
